import com.ssm.service.impl.CardServiceImpl;
import com.sun.jna.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestOcx {
   static String CardNum= (String) CardServiceImpl.rescard().get("pCertNo");
    //    用户姓名
    static  String CardName=(String) CardServiceImpl.rescard().get("pName");
    public interface HDReadCardzx extends Library {

        HDReadCardzx INSTANCE = (HDReadCardzx) Native.loadLibrary("HDReadCardzx", HDReadCardzx.class);//加载动态库文件

        int ReadCertInfo(String pBmpFile, Pointer pName, Pointer pSex, Pointer pNation, Pointer pBirth, Pointer pAddress, Pointer pCertNo, Pointer pDepartment
                , Pointer pEffectData, Pointer pExpire, Pointer pErrMsg
        );//动态库中调用的方法
//        int  ICC_Reader_Open(String xml);
////        int  ICC_Reader_Close(int hReader);
    }

    public static void main(String[] args) {
////     int hande=  HDReadCardzx.INSTANCE.ICC_Reader_Open("USB1");
//        System.setProperty("jna.encoding", "GBK");
//        String pBmpFile = "D:\\zb.bmp";
//        Pointer pName = new Memory(50);
//        Pointer pSex = new Memory(2);
//        Pointer pNation = new Memory(2);
//        Pointer pBirth = new Memory(50);
//        Pointer pAddress = new Memory(100);
//        Pointer pCertNo = new Memory(50);
//        Pointer pDepartment = new Memory(50);
//        Pointer pEffectData = new Memory(50);
//        Pointer pExpire = new Memory(50);
//        Pointer pErrMsg = new Memory(50);
////        System.out.println(System.getProperty("java.library.path"));
//        int card = HDReadCardzx.INSTANCE.ReadCertInfo(pBmpFile, pName, pSex, pNation, pBirth, pAddress, pCertNo, pDepartment, pEffectData, pExpire, pErrMsg);
////            PointerByReference strLicense = new PointerByReference();
////            String license = strLicense.getValue().getString(0, "UTF-8");
//        String res = null;
//        List list = new ArrayList();
//        Map map = new HashMap();
//        System.out.println(card + "dddd");
//        map.put("name", new String(pName.getByteArray(0, 50)));
//        map.put("pSex", new String(pSex.getByteArray(0, 2)));
//        map.put("pNation", new String(pNation.getByteArray(0, 2)));
//        map.put("pBirth", new String(pBirth.getByteArray(0, 50)));
//        map.put("pAddress", new String(pAddress.getByteArray(0, 100)));
//        map.put("pCertNo", new String(pCertNo.getByteArray(0, 50)));
//        map.put("pDepartment", new String(pDepartment.getByteArray(0, 50)));
//        map.put("pEffectData", new String(pEffectData.getByteArray(0, 50)));
//        map.put("pExpire", new String(pExpire.getByteArray(0, 50)));
//        map.put("pErrMsg", new String(pErrMsg.getByteArray(0, 50)));
//
        System.out.println(CardServiceImpl.rescard().get("pName").toString().trim()+"dddd");
    }

}
